// @ts-ignore
/* eslint-disable */
import request from '@/request.ts'

/** 获取轮播图配置 GET /api/carousel/config */
export async function getCarouselConfig(
  params?: { scene?: string },
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseCarouselConfigRequest>('/api/carousel/config', {
    method: 'GET',
    params,
    ...(options || {}),
  })
}

/** 保存轮播图配置 POST /api/carousel/config */
export async function saveCarouselConfig(
  body: API.CarouselConfigRequest,
  params?: { scene?: string },
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseBoolean>('/api/carousel/config', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    params,
    data: body,
    ...(options || {}),
  })
}

/** 更新轮播图项 PUT /api/carousel/item */
export async function updateCarouselItem(body: API.CarouselItem, options?: { [key: string]: any }) {
  return request<API.BaseResponseBoolean>('/api/carousel/item', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}

/** 添加轮播图项 POST /api/carousel/item */
export async function addCarouselItem(body: API.CarouselItem, options?: { [key: string]: any }) {
  return request<API.BaseResponseCarouselItem>('/api/carousel/item', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}

/** 删除轮播图项 DELETE /api/carousel/item/${param0} */
export async function deleteCarouselItem(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.deleteCarouselItemParams,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params
  return request<API.BaseResponseBoolean>(`/api/carousel/item/${param0}`, {
    method: 'DELETE',
    params: { ...queryParams },
    ...(options || {}),
  })
}

/** 获取轮播图项列表 GET /api/carousel/items */
export async function listCarouselItems(
  params?: { scene?: string },
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseListCarouselItem>('/api/carousel/items', {
    method: 'GET',
    params,
    ...(options || {}),
  })
}

/** 更新轮播图项排序 PUT /api/carousel/items/sort */
export async function updateCarouselItemSort(
  body: API.CarouselItem[],
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseBoolean>('/api/carousel/items/sort', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}

/** 上传轮播图图片 POST /api/carousel/upload */
export async function uploadCarouselImage(body: FormData, options?: { [key: string]: any }) {
  return request<API.BaseResponseCarouselImageUploadRequest>('/api/carousel/upload', {
    method: 'POST',
    data: body,
    ...(options || {}),
  })
}
